package com.web.service.impl;

import com.web.dao.UserDao;
import com.web.dao.impl.UserDaoImpl;
import com.web.entity.User;
import com.web.service.UserService;

public class UserServiceImpl implements UserService {

    private UserDao userDao = new UserDaoImpl();
    @Override
    public User login(String username, String password) {
        //请用Dao对象，通过用户名查询用户
        User user = userDao.selectUserByname(username);
        //判断用户是否存在，并且密码是否正确
        if (user != null) {
            if (password.equals(user.getPassword())){
                return user;
            }
        }
        return null;
    }
}
